package cn.ainit.bj.comparsion;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import cn.ainit.bj.comparsion.entity.BjComparison;
import cn.ainit.sys.common.dao.BusinessBaseDao;
@Transactional
@Repository("comparsionDao") //这里要改一个名字
public class ComparsionDaoImpl extends BusinessBaseDao implements ComparsionDao {

	@Override
	public boolean saveComp(BjComparison bjComparison) throws Exception{
		try {
			this.sessionFactory.getCurrentSession().save(bjComparison);//参数改为上面的参数名称
			return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public boolean updCompSave(BjComparison bjComparison) throws Exception{
		try {
			this.getSessionFactory().getCurrentSession().update(bjComparison);//参数改为上面的参数名称
			return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	@Override
	public boolean findComp(String codeId) throws Exception {
		try {
			BjComparison comparison = (BjComparison) this.getSessionFactory().getCurrentSession().get(BjComparison.class, codeId);
			if (comparison != null) {
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
}
